home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_06_02 / v6n2011a.txt < prev    next >
Text File  |  1989-09-26  |  650b  |  19 lines

  1.  
  2.      #define RECORD_SIZE 47   /* Maximum number of characters in 
  3.                                    the record including 1 
  4.                                    for the NUL character */
  5.      char buffer[RECORD_SIZE];
  6.      int record_number;
  7.  
  8.      /* Write a record */     
  9.      record_number = 12;
  10.      sprintf(buffer, "%s %d ",a,xx...);
  11.      fseek(file,(long) RECORD_SIZE * record_number, 0);
  12.      fwrite(buffer,RECORD_SIZE,1,file);
  13.      
  14.      /* Read a record */     
  15.      record_number = 12;
  16.      fseek(file,(long) RECORD_SIZE * record_number, 0);
  17.      fread(buffer,RECORD_SIZE,1,file);
  18.      sscanf(buffer, "%s %d ",&a,&xx...);
  19.